From: Carlos Garnacho Date: Mon, 18 Aug 2025 16:55:32 +0000 (+0200) Subject: status/volume: Handle scroll events distinctly X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~16 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4261b26a53a0afa548872425c4e7bebe768468ae;p=gnome-shell.git status/volume: Handle scroll events distinctly Stop funneling the events to the (maybe hidden) volume slider actor, and handle events directly at the volume status icon. This allows us to move it back to vertical motion, since there are no cues to make us think scroll should be horizontal here. The slider will still prefer horizontal motion. Part-of: --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index f966fbb85..b8f8d8fb4 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -433,12 +433,27 @@ class VolumeIndicator extends SystemIndicator { } _handleScrollEvent(item, event) { - const result = item.slider.scroll(event); - if (result === Clutter.EVENT_PROPAGATE || item.mapped) - return result; + if (event.get_flags() & Clutter.EventFlags.FLAG_POINTER_EMULATED) + return Clutter.EVENT_PROPAGATE; + + let direction = event.get_scroll_direction(); + let nSteps = 0; + if (direction === Clutter.ScrollDirection.DOWN) { + nSteps = -1; + } else if (direction === Clutter.ScrollDirection.UP) { + nSteps = 1; + } else if (direction === Clutter.ScrollDirection.SMOOTH) { + let [, dy] = event.get_scroll_delta(); + nSteps = -dy; + // Match physical direction + if (event.get_scroll_flags() & Clutter.ScrollFlags.INVERTED) + nSteps *= -1; + } + + if (item.mapped || item.slider.step(nSteps)) + item.showOSD(); - item.showOSD(); - return result; + return Clutter.EVENT_STOP; } });